
var app = getApp();
var ApiUrl = app.globalData.ApiUrl;
var mph = require("../../utils/util.js");
Page({

  /**
   * 页面的初始数据
   */
  data: {
    tishiStr:'未设置',
    tishiBlen:null
  },
  //检测是否设置了支付密码
  //index.php?act=member_account&op=get_paypwd_info
  get_paypwd_info() {
    wx.showToast({ title: '加载中', icon: 'loading', duration: 10000 });
    let k = wx.getStorageSync('key');
    let that = this;
    wx.request({
      url: ApiUrl + "/index.php?act=member_account&op=get_paypwd_info",
      data: { key: k },
      dataType: 'json',
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      method: 'post',
      success: function (result) {
        if (result.statusCode == 200) {
          if (result.data.code == 200) {
            console.log('检测是否设置了支付密码:=>',result);
            let res = result.data.datas.state;
            let str = '';
            if (res){
              str = '已设置'
            }else{
              str = '未设置'
            }
            
            that.setData({
              tishiStr: str,
              tishiBlen: res
            })
            wx.hideToast();
          }
        }
      }
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    that.get_paypwd_info()
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    var that = this;
    that.get_paypwd_info();
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})